package br.com.sigmah.domain.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="red_restricao_disciplina")
public class RestricaoDisciplina implements Serializable {
	
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column(name = "rep_it_id")
	private Long id;
	
	@OneToOne
	private Disciplina disciplina;

	 @OneToMany(mappedBy="restricaoDisciplina")
	private List<HorarioIndisponivelDisciplina> horariosIndisponiveisDisciplinas;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Disciplina getDisciplina() {
		return disciplina;
	}

	public void setDisciplina(Disciplina disciplina) {
		this.disciplina = disciplina;
	}

	public List<HorarioIndisponivelDisciplina> getHorariosIndisponiveisDisciplinas() {
		return horariosIndisponiveisDisciplinas;
	}

	public void setHorariosIndisponiveisDisciplinas(
			List<HorarioIndisponivelDisciplina> horariosIndisponiveisDisciplinas) {
		this.horariosIndisponiveisDisciplinas = horariosIndisponiveisDisciplinas;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((disciplina == null) ? 0 : disciplina.hashCode());
		result = prime
				* result
				+ ((horariosIndisponiveisDisciplinas == null) ? 0
						: horariosIndisponiveisDisciplinas.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RestricaoDisciplina other = (RestricaoDisciplina) obj;
		if (disciplina == null) {
			if (other.disciplina != null)
				return false;
		} else if (!disciplina.equals(other.disciplina))
			return false;
		if (horariosIndisponiveisDisciplinas == null) {
			if (other.horariosIndisponiveisDisciplinas != null)
				return false;
		} else if (!horariosIndisponiveisDisciplinas
				.equals(other.horariosIndisponiveisDisciplinas))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
		
	
	
}
